import Cookies from 'js-cookie'
// 定义翻译字段
let translate = {
  zh: {
    '401': '认证失败，无法访问系统资源',
    '403': '当前操作没有权限',
    '404': '访问资源不存在',
    'default': ''
  },
  en: {
    '401': 'Authentication failed, unable to access system resources',
    '403': 'Current operation does not have permissions',
    '404': 'The access resource does not exist',
    'default': ''
  },
  am: {
    '401': 'ማረጋገጥ አልተሳካም፣ የስርዓት ሃብቶችን መድረስ አልተቻለም',
    '403': 'አሁን ያለው ክዋኔ ፈቃድ የለውም',
    '404': 'የመዳረሻ መርጃው የለም።',
    'default': ''
  }
}
let language;
let langType = Cookies.get('locale') ? JSON.parse(Cookies.get('locale')) : 0;
function langTypeFun(view) {
  switch (langType) {
    case 0: // 中文
      language = translate.zh;
      break;
    case 1: // 英语
      language = translate.en;
      break
    case 3: // 阿姆哈拉语
      language = translate.am;
      break;
    default:
      break;
  }
  return view
} langTypeFun(langType)


export default {
  language
}
